package net.sourceforge.openclixml.gui;

import net.sourceforge.openclixml.IElement;


/**
 *
 * @version $Revision: 39 $
 * @author dominikjungo
 *
 * Last changed: $Date: 2008-01-22 21:38:51 +0100 (Tue, 22 Jan 2008) $
 * The License for this file can be found in doc/Licenses/license-OpenCliXML.txt
 */
public final class ViewFactory {
    private static ViewFactory singleton;
    private Class productClass;

    private ViewFactory() {
    }

    public static ViewFactory getFactory() {
        if (singleton == null) {
            singleton = new ViewFactory();
        }

        return singleton;
    }

    public void setClass(final Class productC) {
        this.productClass = productClass;
    }

    public Object produceView(final IElement element)
        throws InstantiationException, IllegalAccessException {
        return productClass.newInstance();
    }
}
